{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python37564bit166e976e2fef40668cb4b6fa95113b74",
   "display_name": "Python 3.7.5 64-bit"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "# Natrual Gradient in QNN\n",
    "\n",
    "Coded by _Zi-Shen Li @ Quantum Algorithm Foundation Group, SUSTech_\n",
    "\n",
    "Based on mindquantum"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 1. Calculate the Matrix Elements of Quantum Fisher Information"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "### Quantum State Method"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from mindquantum import *"
   ]
  },
  {
   "source": [
    "First define the random parameterized quantum circuit (RPQC):"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def RP(rotation_angle):\n",
    "    a = np.random.randint(0, 3)\n",
    "    if a == 0:\n",
    "        return RX(rotation_angle)\n",
    "    elif a == 1:\n",
    "        return RY(rotation_angle)\n",
    "    elif a == 2:\n",
    "        return RZ(rotation_angle)\n",
    "    else: \n",
    "        print(\"error in random Pauli gates\")\n",
    "\n",
    "def bpansatz(n,p):\n",
    "    init_state_circ = UN(RY(np.pi/4),n)\n",
    "    qc = Circuit() + init_state_circ\n",
    "    counter = 0\n",
    "    for j in range(p):\n",
    "        for i in range(n):\n",
    "            qc += RP(str(counter)).on(i)\n",
    "            counter += 1\n",
    "        for ii in range(n-1):\n",
    "            qc += Z(ii,ii+1)\n",
    "    return qc"
   ]
  },
  {
   "source": [
    "Then define the method to get the partial quantum state:"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# give an alternative way to efficiently calculate qfi elements on classical simulator.\n",
    "#partial_index is to index different parameters in the circuit, ranging from 0 to n_params.\n",
    "def dqs(circ, partial_index_1, params):\n",
    "    sim = Simulator('projectq', circ.n_qubits)\n",
    "    params[partial_index_1] += np.pi\n",
    "    sim.apply_circuit(circ, params)\n",
    "    d1_qs = 0.5*sim.get_qs()\n",
    "    params[partial_index_1] -= np.pi\n",
    "    return d1_qs\n",
    "def qs(circ, params):\n",
    "    sim = Simulator('projectq', circ.n_qubits)\n",
    "    sim.apply_circuit(circ, params)\n",
    "    qs0 = sim.get_qs()\n",
    "    return qs0"
   ]
  },
  {
   "source": [
    "Define the difference method to check whether the result of  analytical method is right or not:"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 差分方法 to verify the reliability of the other analytical method.\n",
    "def ddqs(circ, partial_index_1, params, step_length=1e-7):\n",
    "    sim = Simulator('projectq', circ.n_qubits)\n",
    "    sim.apply_circuit(circ, params)\n",
    "    qs0 = sim.get_qs()\n",
    "    params[partial_index_1] += step_length\n",
    "    sim.reset()\n",
    "    sim.apply_circuit(circ, params)\n",
    "    qs1 = sim.get_qs()\n",
    "    dqs = (qs1-qs0)/(step_length)\n",
    "    return dqs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": "The analytical method gives: [ 0.07626998-0.03511134j  0.08669578-0.04098306j -0.09253533-0.05509633j\n  0.01640433+0.07827784j -0.21007554-0.05859412j -0.19587065-0.00518j\n  0.12721992+0.22725388j  0.08941876-0.23233016j]\nThe difference method gives: [ 0.07626998-0.03511135j  0.08669578-0.04098306j -0.09253533-0.05509632j\n  0.01640433+0.07827784j -0.21007554-0.05859412j -0.19587065-0.00518j\n  0.12721992+0.22725388j  0.08941875-0.23233017j]\n"
    }
   ],
   "source": [
    "circ = bpansatz(3,4)\n",
    "params1 = np.random.rand(12)*2*np.pi\n",
    "a = dqs(circ,0,params1)\n",
    "b = ddqs(circ,0,params1)\n",
    "print('The analytical method gives:',a)\n",
    "print('The difference method gives:',b)"
   ]
  },
  {
   "source": [
    "The test shows that the analytical method works. Then go on to calculate the quantum Fisher information matrix:"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# define the qfi matrix\n",
    "\n",
    "def qfi_qsmethod(circ, params):\n",
    "    n_params = len(circ.params_name)\n",
    "    qfi_matrix = np.zeros([n_params, n_params])\n",
    "    qs0 = qs(circ, params)\n",
    "    for i in range(n_params):\n",
    "        dqs1 = dqs(circ, i, params)\n",
    "        for j in range(0,i+1):\n",
    "            dqs0 = dqs(circ, j, params)\n",
    "            qfi_matrix[j, i] = qfi_matrix[i, j] = (np.vdot(dqs0,dqs1)-(np.vdot(dqs0,qs0))*(np.vdot(qs0,dqs1))).real\n",
    "            if qfi_matrix[j, i]<1e-10:\n",
    "                qfi_matrix[j,i]=qfi_matrix[i,j]=0\n",
    "    return qfi_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "n=2\n",
    "p=2\n",
    "circ = bpansatz(n,p)\n",
    "params = np.random.rand(n*p)*(2*np.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "array([[0.125     , 0.        , 0.09410866, 0.        ],\n       [0.        , 0.125     , 0.        , 0.125     ],\n       [0.09410866, 0.        , 0.17914848, 0.        ],\n       [0.        , 0.125     , 0.        , 0.125     ]])"
     },
     "metadata": {},
     "execution_count": 8
    }
   ],
   "source": [
    "qfi_qsmethod(circ, params)"
   ]
  },
  {
   "source": [
    "The above result is the so-called QFI matrix, which reveals the geometric property of PQC over parameter space."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "Note that the above method needs the whole information about the output quantum states which is literally difficult in quantum devices (although it is fast in simulator). Then I try to calculate QFI in another way called Hadamard test. Hadamard test is a convenient way to calculate the inner product between states in quantum devices because it only needs to get some expectation values."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "### Hadamard Test Method"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tqdm import trange"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# define the Hadamard test circuit\n",
    "\n",
    "def circ_htest(circ, partial_param_1, partial_param_2):\n",
    "    n = circ.n_qubits\n",
    "\n",
    "    param_index_1 = circ.params_name.index(partial_param_1)\n",
    "    gate_index_1 = (2*n-1)*(param_index_1//n) + param_index_1%n + n\n",
    "    gate_name_1 = circ[gate_index_1].name\n",
    "    obj_q_1 = circ[gate_index_1].obj_qubits\n",
    "\n",
    "    param_index_2 = circ.params_name.index(partial_param_2)\n",
    "    gate_index_2 = (2*n-1)*(param_index_2//n) + param_index_2%n + n\n",
    "    gate_name_2 = circ[gate_index_2].name\n",
    "    obj_q_2 = circ[gate_index_2].obj_qubits\n",
    "\n",
    "    if gate_name_1 == 'RX':\n",
    "        circ =circ[:(gate_index_1+1)] +H.on(n)+X.on(n)+ X.on(obj_q_1,n)+X.on(n) +circ[(gate_index_1+1):(gate_index_2+1)]\n",
    "    elif gate_name_1 == 'RY':\n",
    "        circ =circ[:(gate_index_1+1)] +H.on(n)+X.on(n)+ Y.on(obj_q_1,n)+X.on(n) +circ[(gate_index_1+1):(gate_index_2+1)]\n",
    "    elif gate_name_1 == 'RZ':\n",
    "        circ =circ[:(gate_index_1+1)] +H.on(n)+X.on(n)+ Z.on(obj_q_1,n)+X.on(n) +circ[(gate_index_1+1):(gate_index_2+1)]\n",
    "    else:\n",
    "        print('Error in partial derivative state relative to partial_param_1')\n",
    "    \n",
    "    if gate_name_1 == 'RX':\n",
    "            circ += X.on(obj_q_2,n)\n",
    "    elif gate_name_1 == 'RY':\n",
    "            circ += Y.on(obj_q_2,n)\n",
    "    elif gate_name_1 == 'RZ':\n",
    "            circ += Y.on(obj_q_2,n)\n",
    "    else:\n",
    "        print('Error in partial derivative state relative to partial_param_2')\n",
    "    \n",
    "    return circ\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "q0: ──RY(π/4)────RX(0)────Z────RX(4)───────────────Z──────RX(8)───────────────Z───────RY(12)────────────────Z───────────────\n                          │                        │                          │                             │\nq1: ──RY(π/4)────RX(1)────●──────Z──────RX(5)──────●────────Z──────RZ(9)──────●─────────Z───────RX(13)──────●───────Z───────\n                                 │                          │                           │                           │\nq2: ──RY(π/4)────RY(2)───────────●────────Z──────RX(6)──────●────────Z──────RY(10)──────●─────────Z───────RX(14)────●────Z──\n                                          │                          │                            │                      │\nq3: ──RY(π/4)────RY(3)────────────────────●──────RX(7)───────────────●──────RZ(11)────────────────●───────RZ(15)─────────●──",
      "text/html": "<pre style=\"white-space: pre;\"><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q0: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────Z────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────Z───────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────────────────Z───────────────</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                          │                        │                          │                             │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q1: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────●──────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RZ</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●─────────Z───────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●───────Z───────</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                                 │                          │                           │                           │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q2: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●─────────Z───────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">14</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────●────Z──</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                                          │                          │                            │                      │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q3: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────────────────────●──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────●──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RZ</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">11</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────────────────●───────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RZ</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">15</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)─────────●──</span>\n</pre>\n"
     },
     "metadata": {},
     "execution_count": 11
    }
   ],
   "source": [
    "#test\n",
    "circ = bpansatz(4,4)\n",
    "circ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "q0: ──RY(π/4)────RX(0)───────────Z──────RX(4)───────────────Z──────RX(8)────────────────\n                                 │                          │\nq1: ──RY(π/4)────RX(1)────X──────●────────Z──────RX(5)──────●────────Z──────RZ(9)────X──\n                          │               │                          │               │\nq2: ──RY(π/4)─────────────┼────RY(2)──────●────────Z──────RX(6)──────●────────Z──────┼──\n                          │                        │                          │      │\nq3: ──RY(π/4)─────────────┼────RY(3)───────────────●──────RX(7)───────────────●──────┼──\n                          │                                                          │\nq4: ─────H─────────X──────●──────X───────────────────────────────────────────────────●──",
      "text/html": "<pre style=\"white-space: pre;\"><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q0: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────────────────</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                                 │                          │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q1: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────X──────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RZ</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)────X──</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                          │               │                          │               │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q2: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)─────────────┼────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●────────Z──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)──────●────────Z──────┼──</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                          │                        │                          │      │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q3: ──</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(π/</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)─────────────┼────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RY</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────●──────</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RX</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">)───────────────●──────┼──</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">                          │                                                          │</span>\n<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">q4: ─────H─────────X──────●──────X───────────────────────────────────────────────────●──</span>\n</pre>\n"
     },
     "metadata": {},
     "execution_count": 12
    }
   ],
   "source": [
    "#test\n",
    "circ_h = circ_htest(circ,'1','9')\n",
    "circ_h"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def qfi_1st_term(circ, partial_param_1, partial_param_2, params):\n",
    "    n = circ.n_qubits\n",
    "    circ = circ_htest(circ, partial_param_1, partial_param_2)\n",
    "    sim = Simulator('projectq', n+1)\n",
    "    ham = Hamiltonian(QubitOperator(f'X{n}'))\n",
    "    sim.apply_circuit(circ, params[:len(circ.params_name)])\n",
    "    expectation = sim.get_expectation(ham).real\n",
    "    return expectation/4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "0.25000000000000006"
     },
     "metadata": {},
     "execution_count": 14
    }
   ],
   "source": [
    "#test\n",
    "circ = bpansatz(6,6)\n",
    "params = np.zeros([36])\n",
    "qfi_1st_term(circ, '0', '0', params)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def qfi_2nd_term_2(circ, partial_param_1, params):\n",
    "    n = circ.n_qubits\n",
    "\n",
    "    param_index_1 = circ.params_name.index(partial_param_1)\n",
    "    gate_index_1 = (2*n-1)*(param_index_1//n) + param_index_1%n + n\n",
    "    gate_name_1 = circ[gate_index_1].name\n",
    "    obj_q_1 = circ[gate_index_1].obj_qubits[0]\n",
    "\n",
    "    circ = circ[:(gate_index_1)]\n",
    "\n",
    "    if gate_name_1 == 'RX':\n",
    "        ham = Hamiltonian(QubitOperator(f'X{obj_q_1}'))\n",
    "    elif gate_name_1 == 'RY':\n",
    "        ham = Hamiltonian(QubitOperator(f'Y{obj_q_1}'))\n",
    "    elif gate_name_1 == 'RZ':\n",
    "        ham = Hamiltonian(QubitOperator(f'Z{obj_q_1}'))\n",
    "    else:\n",
    "        print('Error in qfi_second_term1')\n",
    "    sim = Simulator('projectq', n)\n",
    "    sim.apply_circuit(circ, params[:len(circ.params_name)])\n",
    "    expectation = sim.get_expectation(ham)\n",
    "\n",
    "    return expectation*(-1j/2)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "-0j"
     },
     "metadata": {},
     "execution_count": 16
    }
   ],
   "source": [
    "#test\n",
    "qfi_2nd_term_2(circ, '0', params)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def qfi_2nd_term_1(circ, partial_param_1, params):\n",
    "    n = circ.n_qubits\n",
    "\n",
    "    param_index_1 = circ.params_name.index(partial_param_1)\n",
    "    gate_index_1 = (2*n-1)*(param_index_1//n) + param_index_1%n + n\n",
    "    gate_name_1 = circ[gate_index_1].name\n",
    "    obj_q_1 = circ[gate_index_1].obj_qubits[0]\n",
    "\n",
    "    circ = circ[:(gate_index_1)]\n",
    "\n",
    "    if gate_name_1 == 'RX':\n",
    "        ham = Hamiltonian(QubitOperator(f'X{obj_q_1}'))\n",
    "    elif gate_name_1 == 'RY':\n",
    "        ham = Hamiltonian(QubitOperator(f'Y{obj_q_1}'))\n",
    "    elif gate_name_1 == 'RZ':\n",
    "        ham = Hamiltonian(QubitOperator(f'Z{obj_q_1}'))\n",
    "    else:\n",
    "        print('Error in qfi_second_term2')\n",
    "    sim = Simulator('projectq', n)\n",
    "    sim.apply_circuit(circ, params[:len(circ.params_name)])\n",
    "    expectation = sim.get_expectation(ham)\n",
    "\n",
    "    return expectation*(1j/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "def qfi_element(circ, partial_param_1, partial_param_2, params):\n",
    "    qfi_elem = (qfi_1st_term(circ, partial_param_1, partial_param_2, params)-qfi_2nd_term_1(circ, partial_param_1, params)*qfi_2nd_term_2(circ, partial_param_2, params)).real\n",
    "    if qfi_elem < 1e-10:\n",
    "        return 0\n",
    "    else:\n",
    "        return qfi_elem"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "0.2500000000000001"
     },
     "metadata": {},
     "execution_count": 19
    }
   ],
   "source": [
    "qfi_element(circ, '4', '4', params)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "def qfi_htmethod(circ, params):\n",
    "    params_list = circ.params_name\n",
    "    n_params = len(params_list)\n",
    "    qfi_matrix = np.zeros([n_params, n_params])\n",
    "    for i in range(n_params):\n",
    "        for j in range(0,i+1):\n",
    "            qfi_matrix[j, i] = qfi_matrix[i, j] = qfi_element(circ, params_list[j], params_list[i], params)\n",
    "    return qfi_matrix"
   ]
  },
  {
   "source": [
    "## 2. Calculate the Natrual Gradient"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# define the function which can return the natrual gradient directly.\n",
    "\n",
    "def nat_grad(ham, circ, params):\n",
    "    sim = Simulator('projectq', circ.n_qubits)\n",
    "    exp = sim.get_expectation_with_grad(ham, circ)\n",
    "    grad = exp(params)[1][0,0]\n",
    "    g = qfi_qsmethod(circ, params)\n",
    "    g_pinv = np.linalg.pinv(g)\n",
    "    nat_grad = np.matmul(g_pinv, grad)\n",
    "    return nat_grad.real"
   ]
  },
  {
   "source": [
    "It seems that the natrual gradient overstates the gradient compared with the conventional gradient.\n",
    "\n",
    "Then, I try to check whether the barren plateaus would occur in the natrual gradient framework."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 3. Barren Plateaus of Natrual Gradient?"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tqdm import trange"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_var_nat_partial_exp(circuit,  \n",
    "                        hamiltonian, \n",
    "                        number_of_attempts = 10, #初始采样次数，不是实际的采样次数，程序会根据error_reques自动调整（小概率会影响精度，如果发现跑出来与预期不符，可以适当调大此项）\n",
    "                        error_request = 0.2):   #要求最低的采样误差，这个在很大程度上影响代码运行时间，默认0.2会比较快，而且精度也够\n",
    "    avg_variance = 0\n",
    "    error = 1  #当前误差，初始值设置为最大值1\n",
    "    iteration = 0  #标记迭代次数\n",
    "\n",
    "    #接下里是初次采样\n",
    "    for kk in trange(number_of_attempts):\n",
    "        rdm = np.random.rand(len(circuit.params_name))*2*np.pi\n",
    "        avg_variance += nat_grad(hamiltonian, circuit, rdm)[0]**2/(number_of_attempts)\n",
    "        \n",
    "    \n",
    "    #这里是做审敛的条件循环，若不满足误差要求，会自动增加样本容量，不断采样计算，直到结果满足要求。\n",
    "    while error > error_request:\n",
    "        iteration += 1\n",
    "        variance = 0\n",
    "        for jj in trange(number_of_attempts*(2**(iteration-1))):\n",
    "            rdm = np.random.rand(len(circuit.params_name))*2*np.pi\n",
    "            variance += nat_grad(hamiltonian, circuit, rdm)[0]**2/(number_of_attempts*(2**(iteration-1)))\n",
    "        avg_variance_i = avg_variance\n",
    "        avg_variance = (variance + avg_variance)/2\n",
    "        error = abs(avg_variance-avg_variance_i)/(avg_variance)\n",
    "        print(\"已迭代次数：\",iteration, \"\\t\" \"当前采样误差\" ,error)\n",
    "    return avg_variance\n",
    "\n",
    "# define sampling method to obain the variance of conventional gradient.\n",
    "def get_var_partial_exp(circuit,  \n",
    "                        hamiltonian, \n",
    "                        number_of_attempts = 10, #初始采样次数，不是实际的采样次数，程序会根据error_reques自动调整（小概率会影响精度，如果发现跑出来与预期不符，可以适当调大此项）\n",
    "                        error_request = 0.2):   #要求最低的采样误差，这个在很大程度上影响代码运行时间，默认0.2会比较快，而且精度也够\n",
    "    simulator = Simulator('projectq',circuit.n_qubits)\n",
    "    grad_ops = simulator.get_expectation_with_grad(hamiltonian, circuit)\n",
    "    avg_variance = 0\n",
    "    error = 1  #当前误差，初始值设置为最大值1\n",
    "    iteration = 0  #标记迭代次数\n",
    "\n",
    "    #接下里是初次采样\n",
    "    for kk in trange(number_of_attempts):\n",
    "        rdm = np.random.rand(len(circuit.params_name))*2*np.pi\n",
    "        avg_variance += grad_ops(rdm)[1][0,0,0].real**2/(number_of_attempts)\n",
    "    \n",
    "    #这里是做审敛的条件循环，若不满足误差要求，会自动增加样本容量，不断采样计算，直到结果满足要求。\n",
    "    while error > error_request:\n",
    "        iteration += 1\n",
    "        variance = 0\n",
    "        for jj in trange(number_of_attempts*(2**(iteration-1))):\n",
    "            rdm = np.random.rand(len(circuit.params_name))*2*np.pi\n",
    "            variance += grad_ops(rdm)[1][0,0,0].real**2/(number_of_attempts*(2**(iteration-1)))\n",
    "        avg_variance_i = avg_variance\n",
    "        avg_variance = (variance + avg_variance)/2\n",
    "        error = abs(avg_variance-avg_variance_i)/(avg_variance)\n",
    "        print(\"已迭代次数：\",iteration, \"\\t\" \"当前采样误差\" ,error)\n",
    "    return avg_variance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": "n =  2\n100%|██████████| 10/10 [00:00<00:00, 168.26it/s]\n100%|██████████| 10/10 [00:00<00:00, 227.55it/s]\n已迭代次数： 1 \t当前采样误差 0.1245139464755985\nn =  3\n100%|██████████| 10/10 [00:00<00:00, 78.87it/s]\n100%|██████████| 10/10 [00:00<00:00, 93.91it/s]\n已迭代次数： 1 \t当前采样误差 0.4013652023393932\n100%|██████████| 20/20 [00:00<00:00, 94.12it/s]\n已迭代次数： 2 \t当前采样误差 0.03367684543137717\nn =  4\n100%|██████████| 10/10 [00:00<00:00, 114.30it/s]\n100%|██████████| 10/10 [00:00<00:00, 167.19it/s]\n已迭代次数： 1 \t当前采样误差 0.14821138181146107\nn =  5\n100%|██████████| 10/10 [00:00<00:00, 88.43it/s]\n100%|██████████| 10/10 [00:00<00:00, 130.69it/s]\n已迭代次数： 1 \t当前采样误差 0.4376269863346851\n100%|██████████| 20/20 [00:00<00:00, 132.45it/s]\n已迭代次数： 2 \t当前采样误差 0.0853572225791147\nn =  6\n100%|██████████| 10/10 [00:00<00:00, 72.15it/s]\n100%|██████████| 10/10 [00:00<00:00, 105.99it/s]已迭代次数： 1 \t当前采样误差 0.24877792112136926\n\n"
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "Text(0.5, 0, 'number of qubits')"
     },
     "metadata": {},
     "execution_count": 61
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"379.7pt\" height=\"277.314375pt\" viewBox=\"0 0 379.7 277.314375\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2022-02-03T15:23:11.081886</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.5.0, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 277.314375 \nL 379.7 277.314375 \nL 379.7 0 \nL 0 0 \nL 0 277.314375 \nz\n\" style=\"fill: none\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 37.7 239.758125 \nL 372.5 239.758125 \nL 372.5 22.318125 \nL 37.7 22.318125 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <defs>\n       <path id=\"m682ce4928c\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"52.918182\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 2.0 -->\n      <g transform=\"translate(44.966619 254.356562)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"90.963636\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 2.5 -->\n      <g transform=\"translate(83.012074 254.356562)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"129.009091\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 3.0 -->\n      <g transform=\"translate(121.057528 254.356562)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-33\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"167.054545\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 3.5 -->\n      <g transform=\"translate(159.102983 254.356562)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-33\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"205.1\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 4.0 -->\n      <g transform=\"translate(197.148438 254.356562)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-34\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"243.145455\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 4.5 -->\n      <g transform=\"translate(235.193892 254.356562)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-34\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_7\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"281.190909\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 5.0 -->\n      <g transform=\"translate(273.239347 254.356562)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-35\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"319.236364\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 5.5 -->\n      <g transform=\"translate(311.284801 254.356562)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-35\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_9\">\n      <g>\n       <use xlink:href=\"#m682ce4928c\" x=\"357.281818\" y=\"239.758125\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 6.0 -->\n      <g transform=\"translate(349.330256 254.356562)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-36\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- number of qubits -->\n     <g transform=\"translate(162.117188 268.034687)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-75\" d=\"M 544 1381 \nL 544 3500 \nL 1119 3500 \nL 1119 1403 \nQ 1119 906 1312 657 \nQ 1506 409 1894 409 \nQ 2359 409 2629 706 \nQ 2900 1003 2900 1516 \nL 2900 3500 \nL 3475 3500 \nL 3475 0 \nL 2900 0 \nL 2900 538 \nQ 2691 219 2414 64 \nQ 2138 -91 1772 -91 \nQ 1169 -91 856 284 \nQ 544 659 544 1381 \nz\nM 1991 3584 \nL 1991 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6d\" d=\"M 3328 2828 \nQ 3544 3216 3844 3400 \nQ 4144 3584 4550 3584 \nQ 5097 3584 5394 3201 \nQ 5691 2819 5691 2113 \nL 5691 0 \nL 5113 0 \nL 5113 2094 \nQ 5113 2597 4934 2840 \nQ 4756 3084 4391 3084 \nQ 3944 3084 3684 2787 \nQ 3425 2491 3425 1978 \nL 3425 0 \nL 2847 0 \nL 2847 2094 \nQ 2847 2600 2669 2842 \nQ 2491 3084 2119 3084 \nQ 1678 3084 1418 2786 \nQ 1159 2488 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1356 3278 1631 3431 \nQ 1906 3584 2284 3584 \nQ 2666 3584 2933 3390 \nQ 3200 3197 3328 2828 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-62\" d=\"M 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\nM 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2969 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \nQ 2534 3019 2420 3045 \nQ 2306 3072 2169 3072 \nQ 1681 3072 1420 2755 \nQ 1159 2438 1159 1844 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1341 3275 1631 3429 \nQ 1922 3584 2338 3584 \nQ 2397 3584 2469 3576 \nQ 2541 3569 2628 3553 \nL 2631 2963 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-66\" d=\"M 2375 4863 \nL 2375 4384 \nL 1825 4384 \nQ 1516 4384 1395 4259 \nQ 1275 4134 1275 3809 \nL 1275 3500 \nL 2222 3500 \nL 2222 3053 \nL 1275 3053 \nL 1275 0 \nL 697 0 \nL 697 3053 \nL 147 3053 \nL 147 3500 \nL 697 3500 \nL 697 3744 \nQ 697 4328 969 4595 \nQ 1241 4863 1831 4863 \nL 2375 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-71\" d=\"M 947 1747 \nQ 947 1113 1208 752 \nQ 1469 391 1925 391 \nQ 2381 391 2643 752 \nQ 2906 1113 2906 1747 \nQ 2906 2381 2643 2742 \nQ 2381 3103 1925 3103 \nQ 1469 3103 1208 2742 \nQ 947 2381 947 1747 \nz\nM 2906 525 \nQ 2725 213 2448 61 \nQ 2172 -91 1784 -91 \nQ 1150 -91 751 415 \nQ 353 922 353 1747 \nQ 353 2572 751 3078 \nQ 1150 3584 1784 3584 \nQ 2172 3584 2448 3432 \nQ 2725 3281 2906 2969 \nL 2906 3500 \nL 3481 3500 \nL 3481 -1331 \nL 2906 -1331 \nL 2906 525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-6e\"/>\n      <use xlink:href=\"#DejaVuSans-75\" x=\"63.378906\"/>\n      <use xlink:href=\"#DejaVuSans-6d\" x=\"126.757812\"/>\n      <use xlink:href=\"#DejaVuSans-62\" x=\"224.169922\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"287.646484\"/>\n      <use xlink:href=\"#DejaVuSans-72\" x=\"349.169922\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"390.283203\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" x=\"422.070312\"/>\n      <use xlink:href=\"#DejaVuSans-66\" x=\"483.251953\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"518.457031\"/>\n      <use xlink:href=\"#DejaVuSans-71\" x=\"550.244141\"/>\n      <use xlink:href=\"#DejaVuSans-75\" x=\"613.720703\"/>\n      <use xlink:href=\"#DejaVuSans-62\" x=\"677.099609\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"740.576172\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"768.359375\"/>\n      <use xlink:href=\"#DejaVuSans-73\" x=\"807.568359\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_10\">\n      <defs>\n       <path id=\"m81f619686f\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m81f619686f\" x=\"37.7\" y=\"181.864906\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- $\\mathdefault{10^{-2}}$ -->\n      <g transform=\"translate(7.2 185.664124)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \nL 4684 2272 \nL 4684 1741 \nL 678 1741 \nL 678 2272 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(0 0.765625)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.623047 0.765625)\"/>\n       <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(128.203125 39.046875)scale(0.7)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(186.855469 39.046875)scale(0.7)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_11\">\n      <defs>\n       <path id=\"m32aeb36c1b\" d=\"M 0 0 \nL -2 0 \n\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"235.362847\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"221.291048\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_13\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"209.393511\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"199.087396\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_15\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"189.996758\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_7\">\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"128.366964\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_8\">\n     <g id=\"line2d_17\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"97.072674\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_9\">\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"74.869022\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_10\">\n     <g id=\"line2d_19\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"57.646531\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_11\">\n     <g id=\"line2d_20\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"43.574732\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_12\">\n     <g id=\"line2d_21\">\n      <g>\n       <use xlink:href=\"#m32aeb36c1b\" x=\"37.7\" y=\"31.677195\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n      </g>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_22\">\n    <path d=\"M 52.918182 32.201761 \nL 129.009091 92.739095 \nL 205.1 96.543859 \nL 281.190909 92.965771 \nL 357.281818 229.874489 \n\" clip-path=\"url(#p88d5e4e8b8)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 37.7 239.758125 \nL 37.7 22.318125 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 372.5 239.758125 \nL 372.5 22.318125 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 37.7 239.758125 \nL 372.5 239.758125 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 37.7 22.318125 \nL 372.5 22.318125 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_12\">\n    <!-- regular gradient version -->\n    <g transform=\"translate(132.59 16.318125)scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-67\" d=\"M 2906 1791 \nQ 2906 2416 2648 2759 \nQ 2391 3103 1925 3103 \nQ 1463 3103 1205 2759 \nQ 947 2416 947 1791 \nQ 947 1169 1205 825 \nQ 1463 481 1925 481 \nQ 2391 481 2648 825 \nQ 2906 1169 2906 1791 \nz\nM 3481 434 \nQ 3481 -459 3084 -895 \nQ 2688 -1331 1869 -1331 \nQ 1566 -1331 1297 -1286 \nQ 1028 -1241 775 -1147 \nL 775 -588 \nQ 1028 -725 1275 -790 \nQ 1522 -856 1778 -856 \nQ 2344 -856 2625 -561 \nQ 2906 -266 2906 331 \nL 2906 616 \nQ 2728 306 2450 153 \nQ 2172 0 1784 0 \nQ 1141 0 747 490 \nQ 353 981 353 1791 \nQ 353 2603 747 3093 \nQ 1141 3584 1784 3584 \nQ 2172 3584 2450 3431 \nQ 2728 3278 2906 2969 \nL 2906 3500 \nL 3481 3500 \nL 3481 434 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \nL 2906 4863 \nL 3481 4863 \nL 3481 0 \nL 2906 0 \nL 2906 525 \nQ 2725 213 2448 61 \nQ 2172 -91 1784 -91 \nQ 1150 -91 751 415 \nQ 353 922 353 1747 \nQ 353 2572 751 3078 \nQ 1150 3584 1784 3584 \nQ 2172 3584 2448 3432 \nQ 2725 3281 2906 2969 \nz\nM 947 1747 \nQ 947 1113 1208 752 \nQ 1469 391 1925 391 \nQ 2381 391 2643 752 \nQ 2906 1113 2906 1747 \nQ 2906 2381 2643 2742 \nQ 2381 3103 1925 3103 \nQ 1469 3103 1208 2742 \nQ 947 2381 947 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-76\" d=\"M 191 3500 \nL 800 3500 \nL 1894 563 \nL 2988 3500 \nL 3597 3500 \nL 2284 0 \nL 1503 0 \nL 191 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-72\"/>\n     <use xlink:href=\"#DejaVuSans-65\" x=\"38.863281\"/>\n     <use xlink:href=\"#DejaVuSans-67\" x=\"100.386719\"/>\n     <use xlink:href=\"#DejaVuSans-75\" x=\"163.863281\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" x=\"227.242188\"/>\n     <use xlink:href=\"#DejaVuSans-61\" x=\"255.025391\"/>\n     <use xlink:href=\"#DejaVuSans-72\" x=\"316.304688\"/>\n     <use xlink:href=\"#DejaVuSans-20\" x=\"357.417969\"/>\n     <use xlink:href=\"#DejaVuSans-67\" x=\"389.205078\"/>\n     <use xlink:href=\"#DejaVuSans-72\" x=\"452.681641\"/>\n     <use xlink:href=\"#DejaVuSans-61\" x=\"493.794922\"/>\n     <use xlink:href=\"#DejaVuSans-64\" x=\"555.074219\"/>\n     <use xlink:href=\"#DejaVuSans-69\" x=\"618.550781\"/>\n     <use xlink:href=\"#DejaVuSans-65\" x=\"646.333984\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" x=\"707.857422\"/>\n     <use xlink:href=\"#DejaVuSans-74\" x=\"771.236328\"/>\n     <use xlink:href=\"#DejaVuSans-20\" x=\"810.445312\"/>\n     <use xlink:href=\"#DejaVuSans-76\" x=\"842.232422\"/>\n     <use xlink:href=\"#DejaVuSans-65\" x=\"901.412109\"/>\n     <use xlink:href=\"#DejaVuSans-72\" x=\"962.935547\"/>\n     <use xlink:href=\"#DejaVuSans-73\" x=\"1004.048828\"/>\n     <use xlink:href=\"#DejaVuSans-69\" x=\"1056.148438\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" x=\"1083.931641\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" x=\"1145.113281\"/>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p88d5e4e8b8\">\n   <rect x=\"37.7\" y=\"22.318125\" width=\"334.8\" height=\"217.44\"/>\n  </clipPath>\n </defs>\n</svg>\n",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEWCAYAAABliCz2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAhqklEQVR4nO3deZwU9ZnH8c8z08zADDAewyGCInKq8QA8QcSoaFA0ind0PcELTRQTFbOJ2U2MZrObVTDeERWJEhUDKpAoui4gKKBc4sEqp6gIMtzHDL/9o6qhaefoYbq7qru+79drXtNTVV31dM30t6p/PU+1OecQEZH8VxB0ASIikh0KfBGRiFDgi4hEhAJfRCQiFPgiIhGhwBcRiQgFvgTOzO4xs1FB15EqM7vSzKYk/LzBzDoEWVM6mdkB/mMqDLoWSa9Y0AWI5DrnXNN0rMfMRgLLnXO/TMf69pRzbimQlsck4aIzfKmTmYX2xKChZ6FhfmyZFNXHHXUKfKmWmS02szvMbC6w0cxiZnacmU0zs7VmNsfM+iYsf5CZvWNm683sDTN7KD5MY2Z9zWx5Nes/tYZt/83MvjKzCn+dhybMG2lmD5v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K7wP18jWB59IDtAZvuSKPwJjzPu0otf2cB1bzOwDvI9QvNqf9u94Y/xz/cD9AjirtpU452b7b6y+5096wjn3QR3bfhjvk40W4l2qOPHDS+4EXsUL6JlA04R5S/3tNAeud85tsd0/QXE88KL/ZvPNeG/gdsJ75fImMKeOuiRCdLVMkQCY2dvA7f6/WIpkhYZ0REQiQmf4IiIRoTN8EZGIUOCLiESEAl9EJCIU+CIiEaHAFxGJiP8HLx6SEhmmlScAAAAASUVORK5CYII=\n"
     },
     "metadata": {
      "needs_background": "light"
     }
    }
   ],
   "source": [
    "n_max = 6 # maximal number of  qubits\n",
    "p = 30 # number of layers\n",
    "xxx = np.arange(2,n_max+1) #用于绘图时候的横坐标\n",
    "yyy = np.zeros(n_max-1)        #储存梯度方差的向量\n",
    "hamiltonian = Hamiltonian(QubitOperator('Z0 Z1'))\n",
    "for n in range(2, n_max+1):\n",
    "    circuit = bpansatz(n,p)\n",
    "    print(\"n = \",n)\n",
    "    yyy[n-2] = get_var_partial_exp(circuit, hamiltonian)\n",
    "plt.semilogy(xxx, yyy)\n",
    "plt.title('regular gradient version')\n",
    "plt.xlabel('number of qubits')"
   ]
  },
  {
   "source": [
    "Actually, the natural gradient version costs too much time so I temporally quit. If I get some interesting features, I will post it here."
   ],
   "cell_type": "markdown",
   "metadata": {}
  }
 ]
}